package com.hema.auction.widget.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.hema.auction.R;

import java.util.Arrays;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.bingoogolapple.bgabanner.BGABanner;

/**
 * author by john
 */
public class BannerView extends LinearLayout {

    @BindView(R.id.banner)
    BGABanner banner;
    public BannerView(Context context) {
        super(context);
        init();
    }

    public BannerView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public BannerView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init(){
        ButterKnife.bind(this,LayoutInflater.from(getContext()).inflate(R.layout.layout_banner, this));
        banner.setAdapter((banner1, view, model, position) -> ((ImageView)view).setImageResource((int)model));
        banner.setData(Arrays.asList(R.drawable.ic_defaul_image, R.drawable.ic_defaul_image, R.drawable.ic_defaul_image),null);
    }

}
